CREATE TABLE [dbo].[TDTIPO_OPER]
(
[CO_EMPR] [dbo].[TD_VC_002] NOT NULL,
[CO_TIPO_OPER] [dbo].[TD_VC_003] NOT NULL,
[NU_CORR] [dbo].[TD_IN_001] NOT NULL CONSTRAINT [DF__TDTIPO_OP__NU_CO__033C6B35] DEFAULT ((0)),
[ID_INTE] [dbo].[TD_VC_002] NOT NULL,
[NU_DETA] [dbo].[TD_IN_001] NOT NULL CONSTRAINT [DF__TDTIPO_OP__NU_DE__04308F6E] DEFAULT ((0)),
[CO_OPRC_CNTB] [dbo].[TD_VC_003] NULL,
[NU_ASTO] [dbo].[TD_IN_001] NULL CONSTRAINT [DF__TDTIPO_OP__NU_AS__0524B3A7] DEFAULT ((0)),
[CO_CNTA_EMPR] [dbo].[TD_VC_020] NULL,
[CO_MONE] [dbo].[TD_VC_003] NULL,
[IN_CNTA_MONE] [dbo].[TD_VC_001_SINO] NOT NULL CONSTRAINT [DF__TDTIPO_OP__IN_CN__0618D7E0] DEFAULT ('N'),
[TI_AUXI_EMPR] [dbo].[TD_VC_001] NULL,
[TI_DOCU] [dbo].[TD_VC_003] NULL,
[TI_DOCU_REFE] [dbo].[TD_VC_001_SINO] NOT NULL CONSTRAINT [DF__TDTIPO_OP__TI_DO__08012052] DEFAULT ('N'),
[TI_MOVI] [dbo].[TD_VC_003] NOT NULL,
[IM_0001] [dbo].[TD_IN_001] NOT NULL CONSTRAINT [DF__TDTIPO_OP__IM_00__09E968C4] DEFAULT ((0)),
[OP_ARIT_0001] [dbo].[TD_VC_001] NULL,
[IM_0002] [dbo].[TD_IN_001] NULL CONSTRAINT [DF__TDTIPO_OP__IM_00__0ADD8CFD] DEFAULT ((0)),
[OP_ARIT_0002] [dbo].[TD_VC_001] NULL,
[IM_0003] [dbo].[TD_IN_001] NULL CONSTRAINT [DF__TDTIPO_OP__IM_00__0BD1B136] DEFAULT ((0)),
[DE_GLOS] [dbo].[TD_VC_100] NULL,
[CO_USUA_CREA] [dbo].[TD_VC_008_USUA] NOT NULL CONSTRAINT [DF__TDTIPO_OP__CO_US__0CC5D56F] DEFAULT (suser_sname()),
[FE_USUA_CREA] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TDTIPO_OP__FE_US__0DB9F9A8] DEFAULT (getdate()),
[CO_USUA_MODI] [dbo].[TD_VC_008_USUA] NOT NULL CONSTRAINT [DF__TDTIPO_OP__CO_US__0EAE1DE1] DEFAULT (suser_sname()),
[FE_USUA_MODI] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TDTIPO_OP__FE_US__0FA2421A] DEFAULT (getdate())
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TDTIPO_OPER] WITH NOCHECK ADD CONSTRAINT [CK__TDTIPO_OP__IN_CN__070CFC19] CHECK NOT FOR REPLICATION (([IN_CNTA_MONE]='N' OR [IN_CNTA_MONE]='S'))
GO
ALTER TABLE [dbo].[TDTIPO_OPER] WITH NOCHECK ADD CONSTRAINT [CK__TDTIPO_OP__TI_DO__08F5448B] CHECK NOT FOR REPLICATION (([TI_DOCU_REFE]='N' OR [TI_DOCU_REFE]='S'))
GO
ALTER TABLE [dbo].[TDTIPO_OPER] ADD CONSTRAINT [PK__TDTIPO_O__E185C2CC2A8120DF] PRIMARY KEY CLUSTERED  ([CO_EMPR], [CO_TIPO_OPER], [NU_CORR]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TDTIPO_OPER] ADD CONSTRAINT [FK__TDTIPO_OPER__703F70B1] FOREIGN KEY ([CO_EMPR], [CO_TIPO_OPER]) REFERENCES [dbo].[TTTIPO_OPER] ([CO_EMPR], [CO_TIPO_OPER])
GO
ALTER TABLE [dbo].[TDTIPO_OPER] ADD CONSTRAINT [FK__TDTIPO_OPER__6F4B4C78] FOREIGN KEY ([CO_EMPR], [ID_INTE], [NU_DETA]) REFERENCES [dbo].[TTTIPO_ITES] ([CO_EMPR], [ID_INTE], [NU_DETA])
GO
